home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 3 / Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso / utilities / disksalv2 / makeboot < prev    next >
Text File  |  1996-05-20  |  11KB  |  309 lines

  1. ;======================================================================
  2. ;
  3. ; Some basic strings
  4.  
  5. (set #disksalv-install 
  6.      (cat "\nDiskSalv Boot Disk Generator\n"
  7.           "\nThis utility will format a floppy disk and install DiskSalv"
  8.           " and its support files based on your hard disk setup.  The"
  9.           " result is a bootable floppy with DiskSalv on it.  Proceed?"))
  10.  
  11. (set #disksalv-install-help
  12.      (cat "\nIn the case of a severe hard disk failure, DiskSalv isn't"
  13.           " going to be real useful on your hard disk.  This utility"
  14.           " builds a bootable floppy that may be used in such cases to"
  15.           " streamline such repair activity." ))
  16.  
  17. (set #which-disk
  18.      "In which floppy disk drive should DiskSalv be installed?")
  19.  
  20. (set #any-locale
  21.      (cat "\nInstall DiskSalv Localizations\n"
  22.           "\nYou may install the DiskSalv locale files for various"
  23.           " languages in the Locale directory.  Proceed?"))
  24.  
  25. (set #any-locale-help
  26.      (cat "\nDiskSalv can be operated in different languages."
  27.           "\n\nIf you choose to proceed, you will be asked to"
  28.           " select the translations you want available on your"
  29.       " system."))
  30.  
  31. (set #which-language "\nWhich catalogs should be installed?")
  32.  
  33. (set #which-language-help
  34.      (cat "\nDiskSalv can be operated in many different"
  35.           " languages. One file will be copied to your "
  36.           " hard drive for each language supported.\n\n"
  37.           "To reduce the amount of space consumed by the"
  38.           " language files, you can select only the"
  39.           " files of specific languages to be copied.\n\n"
  40.           "Check the boxes of the languages you wish to"
  41.       " have available on your system.\n\n"
  42.          @askoptions-help))
  43.  
  44. (set #subdir-catalog "locale/catalogs"
  45.      #outdisk-name   "DiskSalv Boot"
  46.      #dscatname      "DiskSalv.catalog"
  47.      #tmp-dir        "T:DiskSalv")
  48.  
  49. (set #get-dearchiver
  50.      (cat "\nPlease specify the file name of a de-archiver "
  51.           "program for \"LHA\"-type files."))
  52.  
  53. (set #ds-done
  54.      (cat "\nDiskSalv boot disk construction is complete.\n"
  55.           "\nPlease be aware that, while every effort has been made"
  56.           " to support your particular setup, it is possible that"
  57.           " some files you need for a simple bootup have not been"
  58.           " copied to the boot disk.  Please try this disk out now,"
  59.           " rather than waiting until you actually need it."))
  60.  
  61. ;======================================================================
  62. ;
  63. ; This function does the actual formatting of the given "outputdisk".
  64. ;
  65.  
  66. (procedure FORMATDISK
  67.     (if (askbool (prompt (cat "Please insert a floppy disk to be formatted "
  68.                               "in drive " outputdisk))
  69.                      (choices "Ok" "Cancel")
  70.                      (help "\nPlease select the floppy disk unit for the installation.\n")
  71.                      (default 1))
  72.         ((working "Formatting disk " outputdisk " as \"" #outdisk-name "\"")
  73.          (run (cat "SYS:System/Format <NIL: >\"CON:10/10/500/50/Formatting...\" DRIVE " 
  74.                    outputdisk " NAME \"" #outdisk-name "\" NOICONS"))
  75.          (run (cat "C:Install DRIVE " outputdisk)))
  76.         (exit "Operation cancelled")))
  77.  
  78. ;======================================================================
  79. ;
  80. ; This function makes all the important directories for the DiskSalv
  81. ; boot disk.
  82. ;
  83.  
  84. (procedure MAKESYS
  85.    (working "Creating System Directories")
  86.    (copyfiles (source  "C:")
  87.               (dest    (tackon outputdisk "C"))
  88.               (pattern (cat "(AddBuffers|AddDataTypes|Assign|BindDrivers|"
  89.                             "ConClip|Copy|Delete|Dir|Execute|IPrefs|List|"
  90.                             "LoadWB|MagTape|MakeDir|Mount|SetClock|"
  91.                             "SetPatch|Version|Wait)")))
  92.    (makedir (tackon outputdisk "Classes"))
  93.    (makedir (tackon outputdisk "Devs"))
  94.    (makedir (tackon outputdisk "Devs/DataTypes"))
  95.    (makedir (tackon outputdisk "Devs/Printers"))
  96.    (copyfiles (source  "Devs:DOSDrivers")
  97.               (dest    (tackon outputdisk "Devs/DOSDrivers"))
  98.               (pattern "#?"))
  99.    (copyfiles (source  "Devs:Keymaps")
  100.               (dest    (tackon outputdisk "Devs/Keymaps"))
  101.               (pattern "#?"))
  102.    (copyfiles (source  "Devs:Monitors")
  103.               (dest    (tackon outputdisk "Devs/Monitors"))
  104.               (pattern "((Dbl|%)(PAL|NTSC)|MultiScan|VGAOnly)")
  105.               (infos))
  106.    (copyfiles (source  "SYS:Expansion")
  107.               (dest    (tackon outputdisk "Expansion"))
  108.               (pattern "#?"))
  109.    (makedir (tackon outputdisk "Fonts"))
  110.    (copyfiles (source  "L:")
  111.               (dest    (tackon outputdisk "L"))
  112.               (pattern "#?FileSystem"))
  113.    (copyfiles (source  "Libs:")
  114.               (dest    (tackon outputdisk "Libs"))
  115.               (pattern "68040|amigaguide|asl|iffparse|locale|version).library"))
  116.    (makedir (tackon outputdisk "Locale"))
  117.    (makedir (tackon outputdisk "Locale/Catalogs"))
  118.    (copyfiles (source  "Locale:Countries")
  119.               (dest    (tackon outputdisk "Locale/Countries"))
  120.               (pattern "#?"))
  121.    (copyfiles (source  "Locale:Languages")
  122.               (dest    (tackon outputdisk "Locale/Languages"))
  123.               (pattern "#?"))
  124.    (makedir (tackon outputdisk "Prefs"))
  125.    (makedir (tackon outputdisk "Prefs/Env-Archive"))
  126.    (copyfiles (source  "ENVARC:Sys")
  127.               (dest    (tackon outputdisk "Prefs/Env-Archive/Sys"))
  128.               (pattern "(pointer|locale|palette|wbconfig).prefs"))
  129.    (copyfiles (source  "S:")
  130.               (dest    (tackon outputdisk "S"))
  131.               (pattern "Startup-Sequence"))
  132.    (makedir (tackon outputdisk "System"))
  133.    (makedir (tackon outputdisk "T"))
  134.    (makedir (tackon outputdisk "Tools"))
  135.    (makedir (tackon outputdisk "Utilities"))
  136.    (makedir (tackon outputdisk "WBStartup"))
  137. )
  138.  
  139. ;======================================================================
  140. ;
  141. ; This function asks about the language, and sets the global "lang" to
  142. ; the language bit mask returned by the request.
  143. ;
  144.  
  145. (procedure ASKLANGUAGE
  146.     (set lang (askoptions (prompt #which-language)
  147.                           (help #which-language-help)
  148.                           (choices "dansk"
  149.                                    "deutsch"
  150.                                    "english"
  151.                                    "français"
  152.                                    "italiano"
  153.                                    "norsk"
  154.                                    "suomi"
  155.                                    "svenska")
  156.                           (default 0))))
  157.     
  158. ;======================================================================
  159. ;
  160. ; This function finds a de-archiver in the user's system, resulting to
  161. ; a panic "ask-the-user" if none can be found.
  162. ;
  163.  
  164. (procedure FINDARCPROG
  165.    (set n 0)
  166.    (while (set test (select n "lharc"
  167.                               "lha"
  168.                               "lz"
  169.                               ""))
  170.       (if (not (run (cat "which " test)))
  171.           (set arcprog test))
  172.       (set n (+ n 1)))
  173.  
  174.    (if (= arcprog "")
  175.        (set arcprog (askfile (prompt #get-dearchiver)
  176.                              (help @askfile-help)
  177.                              (default "C:"))))
  178. )
  179.  
  180. ;======================================================================
  181. ;
  182. ; This function gets the locale file information.  We mark the occasion
  183. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  184. ; for the availability of the archive file. 
  185. ;
  186.  
  187. (procedure ANYLOCALE
  188.    (set localecode 0)
  189.    (if (exists locale-catalogs)
  190.        (set localecode 1))
  191.    (if (exists locale-archive)
  192.        (set localecode (+ localecode 2)))
  193.    localecode)
  194.  
  195. ;======================================================================
  196. ;
  197. ; This function transfers a locale file from the appropriate archive
  198. ; entry to the proper LOCALE:Catalogs subdirectory.
  199. ;
  200.  
  201. (procedure DOCATARCS
  202.    (if (= arcprog "") (FINDARCPROG))
  203.    (if (<> arcprog "")
  204.        ((working "\nDe-archiving selected catalogs\n")
  205.     (makedir #tmp-dir)
  206.         (set arcsfiles (cat #subdir-catalog "/(" arclst ")/#?"))
  207.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  208.                             arcsfiles))
  209.         (set script (tackon #tmp-dir "de-archive-script"))
  210.         (textfile (dest script)
  211.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  212.         (execute script)
  213.         (copyfiles (source (tackon #tmp-dir #subdir-catalog))
  214.                    (dest   output-catalog)
  215.                    (pattern "#?"))
  216.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  217.  
  218. ;======================================================================
  219. ;
  220. ; This function transfers the locale files from the appropriate 
  221. ; existing subdirectories (in "sublst")  to the corresponding
  222. ; LOCALE:Catalogs subdirectories.
  223. ;
  224.  
  225. (procedure DOCATSUBS
  226.    (copyfiles (source locale-catalogs)
  227.               (dest   output-catalog)
  228.               (pattern (cat "(" sublst ")"))))
  229.  
  230. ;======================================================================
  231. ;
  232. ; This function selects the language to be installed.
  233. ;
  234.  
  235. (procedure DOLOCALE
  236.    (set n      0
  237.         sublst ""
  238.         arclst "")
  239.    (while (set language (select n "dansk"
  240.                                   "deutsch"
  241.                                   "english"
  242.                                   "français"
  243.                                   "italiano"
  244.                                   "norsk"
  245.                                   "suomi"
  246.                                   "svenska"
  247.                                   ""))
  248.      (if (AND (IN lang n) (<> n 2))
  249.         (if (exists (tackon locale-catalogs (tackon language #dscatname)))
  250.             (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language)))
  251.             (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language)))))
  252.      (set n (+ n 1)))
  253.    (if (<> sublst "") (DOCATSUBS))
  254.    (if (<> arclst "") (DOCATARCS)))
  255.  
  256. ;======================================================================
  257. ;
  258. ; This procedure asks about installation of catalogs.
  259. ;
  260.  
  261.  
  262. (procedure ASKLOCALE
  263.     (if (ANYLOCALE)
  264.         (if (askbool (prompt #any-locale)
  265.                      (help #any-locale-help)
  266.                      (choices "Yes" "Skip This Part")
  267.                      (default 1))
  268.                   
  269.             ((set askmode 0)
  270.              (ASKLANGUAGE)
  271.              (DOLOCALE)))))
  272.  
  273. ;======================================================================
  274. ;
  275. ; The main program
  276.  
  277. (set inputdir          (pathonly @icon))
  278. (set locale-archive    (tackon inputdir "DSLocale.lha")
  279.      locale-catalogs   (tackon inputdir #subdir-catalog)
  280.      arcprog           ""
  281.      @default-dest     "DF0:")
  282.  
  283. ; First, lets put the DiskSalv stuff in place on a formatted disk.
  284.  
  285. (if (askbool (prompt #disksalv-install)
  286.          (help #disksalv-install-help)
  287.              (choices "Ok" "Cancel")
  288.              (default 1))
  289.    ((set outputdisk  
  290.           (askdir (prompt  #which-disk)
  291.           (help    @askdir-help)
  292.           (default @default-dest)))
  293.      (set @default-dest outputdisk)
  294.      (FORMATDISK)
  295.      (copyfiles (source inputdir)
  296.                 (dest outputdisk)
  297.                 (pattern "DiskSalv")
  298.                 (files)
  299.                 (infos))
  300.      (tooltype  (dest (tackon outputdisk "DiskSalv"))
  301.                 (noposition))
  302.      (MAKESYS)
  303.      (set output-catalog (tackon outputdisk #subdir-catalog))
  304.      (ASKLOCALE)
  305.      (message #ds-done))
  306.     (set @default-dest ""))
  307.  
  308.  
  309.